Ext.define('DCApp.view.docuk.Detail', {
    extend: 'DCApp.view.Detail',
    alias: 'widget.docukdetail',
    
    requires: ['DCApp.ux.ComboTree','Ext.form.field.Tag'],
    bind: {
        title: '文稿 - 【{theObj.id}】'
    },
    
    componentCls: 'docuk-detail',
    bodyPadding: 0,
    
    controller: 'detail',
    
    afterRender: function(ct, position) {
    	var imgpanel = this.down('imgpanel');
    	if(imgpanel){
	    	var tb = imgpanel.down('toolbar[dock=top]');
	    	tb.insert(1,[{
	    		text:'插入'
	    	}]);
    	}
    	var attachpanel = this.down('attachpanel');
    	if(attachpanel){
	    	var tb = attachpanel.down('toolbar[dock=top]');
	    	tb.insert(1,[{
	    		text:'插入'
	    	}]);
    	}
    	this.callParent();
    },
    items: [{
    	listeners: {
		  render: function(p){
			p = p.getEl();
			var me= this.up();
			me.h0=p.getHeight();
		    p.on('scroll', function(e, t){
		    	//console.log(t.scrollTop +"   "+ t.clientHeight);
		    	me.onscroll(t.scrollTop,t.clientHeight);
		    }, p);
		  }
		},
    	title: 'Panel 0',
        flex: 2,
        frame: false,
        xtype: 'container',
        layout: 'anchor',
        style: {
            overflow: 'auto'
        },
        items: [
                {
                    title: '文稿信息',
                    margin: '0 0 10 0',
                    cls:'nav_pos',
                    reference: 'form',
                    bodyPadding: 10,
                    fieldDefaults: {
                        labelAlign: 'right',
                        labelWidth: 100,
                        padding:3
                    },
                    defaults: {
                        anchor: '100%'
                    },
                    xtype: 'form',
                    items: [{
                        xtype: 'fieldcontainer',
                        fieldLabel: '类型',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        defaults: {
                            hideLabel: 'true'
                        },
                        items: [{
                            flex: 2,
                            emptyText: '文稿分类',
                            xtype: 'combobox',
                            queryMode: 'local',
                            valueField: 'abbr',
                            displayField: 'name',
                            store: DCApp.Cfg.getStore('doc_type'),
                            bind: '{theObj.type}',
                            allowBlank: false
                        }, {
                            flex: 2,
                            fieldLabel: '细分类',
                            bind: '{theObj.subtype}',
                            xtype: 'combotree',
                			storeUrl : 'resources/tree_check.json',
                			cascade : 'child',//级联方式:1.child子级联;2.parent,父级联,3,both全部级联
                			checkModel:'single',//当json数据为不带checked的数据时只配置为single,带checked配置为double为单选,不配置为多选
                			width : 270,
                			rootId : '1',
                			rootText : 'DRP',
                			treeNodeParameter : ''
                        }]
                    },{
                        xtype: 'textfield',
                        fieldLabel: '题名',
                        allowBlank: false,
                        bind: '{theObj.title}',
                        publishes: ['value']
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,

                            fieldLabel: '撰稿人',
                            bind: '{theObj.author}',
    				        xtype: 'tagfield',
    				        store: {
    				            type: 'authors'
    				        },
        		    		listConfig: {
    					        getInnerTpl: function() {
    					            return '<div data-qtip="{name}. {pyh}">{name} ({corp})</div>';
    					        }
    					    },
    				        displayField: 'name',
    				        valueField: 'name',
    				        createNewOnEnter: true,
    				        createNewOnBlur: true,
    				        queryMode: 'local',
    				        anyMatch:true,
    				        filterPickList: true
                		}, {
                            flex: 2,
                            fieldLabel: '约稿人',
                            xtype: 'combobox',
                            queryMode: 'local',
                            valueField: 'abbr',
                            displayField: 'name',
                            store: DCApp.Cfg.getStore('doc_linkMan'),
                            bind: '{theObj.linkMan}',
                            allowBlank: false
                        }]
                    },
                  /*  {

                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '登记人',
                            xtype: 'combobox',
                            queryMode: 'local',
                            valueField: 'abbr',
                            displayField: 'name',
                            store: DCApp.Cfg.getStore('doc_linkMan'),
                            bind: '{theObj.editor0}',
                            allowBlank: false
                		},{
                            flex: 2,
                            fieldLabel: '初审',
                            xtype: 'combobox',
                            queryMode: 'local',
                            valueField: 'abbr',
                            displayField: 'name',
                            store: DCApp.Cfg.getStore('doc_linkMan'),
                            bind: '{theObj.dc_editor1}',
                            allowBlank: false
                		}, {
                            flex: 2,
                            fieldLabel: '终审',
                            xtype: 'combobox',
                            queryMode: 'local',
                            valueField: 'abbr',
                            displayField: 'name',
                            store: DCApp.Cfg.getStore('doc_linkMan'),
                            bind: '{theObj.dc_editor2}',
                            allowBlank: false
                        }]
                     },*/
                    {  
	                        xtype: 'fileupload',
	                        name: 'file1',
	                        fieldLabel: '文稿上传',
	                        height:'auto!important',
	                        bind: '{theObj.dcDraft}'
	                        
	                    },{
            	xtype: 'htmleditor',
            	bind: {
                    value: '{theObj.description}'
                },
            	//bind: '{theObj.description}',
            	defaultValue :'',
            	publishes: ['value'],
            	fieldLabel: '正文'
               }]
                },
                {
                    title: '影像列表',
                    margin: '0 0 10 0',
                    cls:'nav_pos',
                    layout:'fit',
                    items:[{
                    	bind: '{theObj.images}',
                    	xtype:'imgpanel'
                    }]                    
                },
                {
                    title: '附件列表',
                    cls:'nav_pos',
                    layout:'fit',
                    items:[{
                    	bind:'{theObj.ceAttachments}',
                    	xtype:'attachpanel'
                    }]                    
                },
				{
					title : '相关文物',
					margin : '0 0 10 0',
					cls : 'nav_pos',
					layout : 'fit',
					items : [
						{
						 bind: {
							 store:'{theObj.relics}'
						 },
						 xtype : 'reliclist',
						 plugins: null,
						 tbar: ['->',{
						        text: '关联',
						        handler: 'onRelList'
						    },{
						        text: '删除',
						        handler: 'onRemove'
						    }]
						}
					]							
				},
				{
					title : '相关论文',
					margin : '0 0 10 0',
					cls : 'nav_pos',
					layout : 'fit',
					items : [
						{
						 bind: '{theObj.theses}',
						 xtype : 'thesislist',
						 plugins: null,
						 tbar: ['->',{
						        text: '关联',
						        handler: 'onRel'
						    },{
						        text: '删除',
						        handler: 'onRemove'
						    }]
						}
					]							
				},
				{
					title : '相关建筑',
					margin : '0 0 10 0',
					cls : 'nav_pos',
					layout : 'fit',
					items : [
						{
							bind: '{theObj.buildings}',
							xtype : 'buildinglist',
							plugins: null,
						 	tbar: ['->',{
						        text: '关联',
						        handler: 'onRel'
						    },{
						        text: '删除',
						        handler: 'onRemove'
						    }]
						}
					]							
				},
				{
					title : '相关文稿',
					margin : '0 0 10 0',
					cls : 'nav_pos',
					layout : 'fit',
					items : [
						{
							bind: '{theObj.docs}',
							xtype : 'doclist',
							plugins: null,
						 	tbar: ['->',{
						        text: '关联',
						        handler: 'onRel'
						    },{
						        text: '删除',
						        handler: 'onRemove'
						    }]
						}
					]							
				},
				{
					title : '相关人物',
					margin : '0 0 10 0',
					cls : 'nav_pos',
					layout : 'fit',
					items : [
						{
							bind: '{theObj.figures}',
							xtype : 'figurelist',
							plugins: null,
						 	tbar: ['->',{
						        text: '关联',
						        handler: 'onRel'
						    },{
						        text: '删除',
						        handler: 'onRemove'
						    }]
						}
					]							
				},
				{
					title : '相关音视频',
					margin : '0 0 10 0',
					cls : 'nav_pos',
					layout : 'fit',
					items : [
						{
							bind: '{theObj.audioVideos}',
							xtype : 'avlist',
							plugins: null,
						 	tbar: ['->',{
						        text: '关联',
						        handler: 'onRel'
						    },{
						        text: '删除',
						        handler: 'onRemove'
						    }]
						}
					]							
				},
				{
					title : '相关礼品',
					margin : '0 0 10 0',
					cls : 'nav_pos',
					layout : 'fit',
					items : [
						{
							bind: '{theObj.ceGifts}',
							xtype : 'giftlist',
							plugins: null,
						 	tbar: ['->',{
						        text: '关联',
						        handler: 'onRel'
						    },{
						        text: '删除',
						        handler: 'onRemove'
						    }]
						}
					]							
				}/*,
					{
                    title: '稿酬',
                    flex: 2,
                    cls:'nav_pos',
                    layout:'fit',
                    items:[{
                    	xtype:'paylist'
                    }]                    
                }*/
            ]
        }]
});
